package com.xncoding.freemarker.Interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor());

        //  添加拦截器
//        registry.addInterceptor(myInterceptor)
//                .excludePathPatterns("")  //  排除拦截器要拦截的路径
//                .addPathPatterns("");    //  添加拦截器需要要拦截的路径
    }
}
